<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>FKXJBAR</title>
    <style>
        *{
            margin: 0;
            padding: 0;
        }
        #window{
            width: 525px;
            height: 360px;
            background: rgb(218, 218, 218);
            margin-top: 20%;
            margin-left:20%;
            padding: 5px;
        }
        #progress{
            margin-top: 2px;
            width: 520px;
            height: 30px;
            background: rgb(156, 156, 156);
        }
        #bar{
            width: 1%;
            height: 28px;
            margin-top: 1px;
            background: rgb(13, 1, 182);
        }

    </style>
</head>
<body background="BG.bmp">
    <div id="window">
        <p id="Date">
        </p>
        <p id="Pic">
            <img border="0" src="DQ.jpg">
        </p>
        <p>
            闯关进度
        </p>
        <div id="progress">
            <div id="bar"></div>
        </div>
        <div id="text-progress">0%</div>
    </div>

<script>
    Date.prototype.format = function(fmt){
    var o = {
        "M+" : this.getMonth()+1,                 //月份
        "d+" : this.getDate(),                    //日
        "h+" : this.getHours(),                   //小时
        "m+" : this.getMinutes(),                 //分
        "s+" : this.getSeconds(),                 //秒
        "q+" : Math.floor((this.getMonth()+3)/3), //季度
        "S"  : this.getMilliseconds()             //毫秒
    };

    if(/(y+)/.test(fmt)){
        fmt=fmt.replace(RegExp.$1, (this.getFullYear()+"").substr(4 - RegExp.$1.length));
    }
            
    for(var k in o){
        if(new RegExp("("+ k +")").test(fmt)){
        fmt = fmt.replace(
            RegExp.$1, (RegExp.$1.length==1) ? (o[k]) : (("00"+ o[k]).substr((""+ o[k]).length)));  
        }       
    }

    return fmt;
    }
    var from = new Date(2019,5,3);
    var now = new Date();
    var diff = now - from
    var nowStr = now.format("yyyy-MM-dd hh:mm:ss");

    var s1 = '2019-06-03';
    s1 = new Date(s1.replace(/-/g, "/"));
    s2 = new Date();//当前日期：2017-04-24
    var days = s2.getTime() - s1.getTime();
    var time = parseInt(days / (1000 * 60 * 60 * 24));
    document.getElementById("Date").innerHTML=new Date().format("今天是yyyy年MM月dd日 距离勇士离开故土已经".concat(time)+"天");
    
    var iSpeed=0;
    obj=setInterval(function(){
        iSpeed+=0.1;
        if(iSpeed>=time/365*100){    // 设置达到多少进度后停止
            clearInterval(obj); 
            }
        
        bar.style.width=iSpeed+'%';
        document.getElementById('text-progress').innerHTML="噩梦进行"+Number(iSpeed).toFixed(1)+'%';

    },1);
</script>

</body>
</html>